This library aims for formatting strings and numbers rather than an generic type. Syntax for the format string is derived from std::fmt.
Getting Started
Add this to your Cargo.toml file.
[]
= "0.1"
Or add from command line.
See docs and examples to know how to use it.
Example
SOURCE: format! with non literal string
use formatx;
OUTPUT
Bonjour Léa, le nombre est 1
Hola Sofia, el numero es 2
Hi Ashley, the number is 3
Limitations
Examples given below will always panic.
-
Only types which implements Display + Debug traits are supported. Other formatting-traits aren't supported.
-
Local variable interpolation isn't supported.
let people = "Rustaceans";
formatx!.unwrap.text.unwrap;
- Intermingling the two types of positional specifiers isn't supported.
formatx!.unwrap;
- Parameter setting through
$
sign argument isn't supported.
formatx!.unwrap;
- An asterisk
.*
can't be used to set precision.
formatx!.unwrap;
Alternatives
License
Dual Licensed